package com.fqgj.xjd.user.so;

import com.fqgj.base.services.redis.TimeConsts;
import com.fqgj.common.utils.MD5;
import com.fqgj.common.utils.TimeUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

/**
 * name:
 * auth:ting.li@qianli-inc.com
 * date:2017/12/28 14:38
 * version: v1.0.0
 **/
public class UserAccessToken implements Serializable {
    private static final long serialVersionUID = 8114263741949541770L;
    private String userCode;
    private String token;
    private Date   expireDate;
    public UserAccessToken(String userCode) {
        this.userCode = userCode;
        this.expireDate = TimeUtils.appointed(TimeConsts.ONE_MONTH_DAYS);
        this.token = createToken();
    }
    public String getUserCode() {
        return userCode;
    }
    public String getToken() {
        return token;
    }
    public Date getExpireDate() {
        return expireDate;
    }
    private String createToken() {
        return MD5.md5(UUID.randomUUID().toString());
    }
}
